This article provides an overview on how to perform read operations in Ditto, including how to construct your queries, use $args
to query for dynamic data, sort and limit your results, and perform index testing.
create
, read
, update
, and delete
(CRUD) operations, see Ditto Basics CRUD Fundamentals.if
statements. In addition, you can use intuitive query condition operators. For more information, see Ditto Basics Query Syntax and Platform Manual > Querying Techniques.
serializedAs: latestValuesAndTypes
in your request.$args
map object:
id
) or, if applicable, composite key, use the following endpoint:
people
collection with the document ID of 123abc
:
find
method fetches the current version of multiple documents from Ditto Server:
find
query within a write
command in a single operation. Instead, perform each as separate API calls. For instructions, see Performing Find and Write Operations.find
query within a write
command in a single operation. Instead, perform each operation as separate API calls:
find
request to fetch the documents.write
request to create or modify documents.sort
direction in your request, the documents are returned in an arbitrary order.
_id
ascending in your request as follows:name
field property set to ascending (asc
) order.age
field property set to descending (desc
) order.limit
method before executing your query.
For example, the following snippet demonstrates a limit of 100
results for documents within the people
collection with a field property of color
set to the value of red
:
describe
field set to true
in the JSON body of your request.
For example:
"index_scan"
response:
"full_scan"
response:
find
query within a write
command in a single operation. Instead, perform the following as separate API calls:
find
request to fetch the documents.write
request to create create or modify documents.count
command:
Accessible using the following URL endpoint, the count
command determines the number of documents that match a specific query expression at a particular moment in time:
count
command, you can write queries directly in your request or, if querying dynamic data, pass them as $args
. For more information about using args]().count
the number of documents within the people
collection with the field property of name
set to the value of John
: